package com.sloth.bear.controller;

import com.sloth.bear.annotation.NoAuth;
import com.sloth.bear.dto.request.LoginRequest;
import com.sloth.bear.dto.vo.LoginVo;
import com.sloth.bear.service.UserService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    private final UserService userService;

//    /**
//     * 用户注册
//     */
//    @PostMapping("/register")
//    public void createUser(@RequestBody @Valid UserCreateRequest request) {
//        userService.createUser(request);
//    }

    /**
     * 用户登录
     */
    @PostMapping("/login")
    @NoAuth
    public LoginVo login(@RequestBody @Valid LoginRequest request) {
        return userService.login(request);
    }
}